/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-06-20
 * Time: 21:26
 */
//实现无头单链表的基本操作
public class Test {
    public static void main(String[] args) {
        ListNode list=new ListNode();
        list.addhead(0);
        list.addhead(1);
        list.addhead(2);
        list.addhead(3);
        list.display();
        list.addLast(1);
        list.addLast(2);
        list.addLast(3);
        list.display();
        list.addIndex(4,99);
        list.addIndex(3,99);
        list.display();
        System.out.println("size="+list.size());
        System.out.println("该链表中是否有99"+list.contains(99));
        list.remove(0);
        list.removeAllKey(99);
        System.out.print("删除0和99");
        list.display();
        list.clear();
        System.out.println("size="+list.size());
        list.display();
    }
}
